package com.zby.likou;

public class Demo02 {
    public static void main(String[] args) {
        int[] a = {
                1, 2, 3, 4, 5, 6, 7
        };
        Demo02 demo02 = new Demo02();
        demo02.rotate(a, 3);
    }

    public void rotate(int[] nums, int k) {
        if (k == 0) {
            for (int i = 0; i < nums.length; i++) {
                System.out.println(nums[i]);
            }
        }
        int number = 0;

        while (number < k) {
            for (int i = nums.length - 1; i > 0; i--) {
                int temp = nums[i];
                nums[i] = nums[i - 1];
                nums[i - 1] = temp;


            }
            number++;
        }
        for (int i = 0; i < nums.length; i++) {
            System.out.print(nums[i]);
        }
    }
}
